package flc.ast.adapter;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.FilterBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class VideoSpliceAdapter extends StkProviderMultiAdapter<String> {

    private int position=0;

    public VideoSpliceAdapter() {
        addItemProvider(new StkSingleSpanProvider(87));
        addItemProvider(new VideoSpliceProvider());
    }

    public void clearPosition(){
        this.position=0;
    }

    private class VideoSpliceProvider extends BaseItemProvider<String> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_video_splice;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, String str) {
            Glide.with(getContext()).load(str).into((ImageView) baseViewHolder.getView(R.id.ivVideoSpliceItemImg));
            position++;
            Log.e("TAG", "convert: "+getItemPosition(str) );
            if (position==getItemCount()){
                baseViewHolder.setVisible(R.id.ivVideoSpliceItemSwap,false);
            }else {
                baseViewHolder.setVisible(R.id.ivVideoSpliceItemSwap,true);
            }
        }
    }

}
